<?php
    header('Cache-control: private'); // IE 6 FIX

    if(isSet($_POST['style']))
    {
        $styl = $_POST['style'];
        // register the session and set the cookie
        $_SESSION['style'] = $styl;
        setcookie('style', $styl, time() + (3600 * 24 * 30));
    }
    else if(isSet($_SESSION['style']))
    {
        $styl = $_SESSION['style'];
    }
    else if(isSet($_COOKIE['style']))
    {
        $styl = $_COOKIE['style'];
    }
    else
    {
        $styl = 'light';
    }
    if(!isSet($_COOKIE['style']))
            setcookie('style', $styl, time() + (3600 * 24 * 30));
            
    echo '<link href="styles/global.css" rel="stylesheet" type="text/css">';     
    echo '<link href="styles/'.$styl.'/style.css" rel="stylesheet" type="text/css">';
?>
